import { CameraSetPosOptions, Vector3 } from "@minecraft/server";
import {
    CubeRegion,
    GameRegion,
    SphereRegion,
} from "@sapi-game/gameRegion/gameRegion";
import { GameStructure } from "@sapi-game/gameStructure/gameStructure";
import { DimensionIds } from "@sapi-game/utils/vanila-data";

export interface CvSMap {
    name: string;
    chestPoints: Vector3[];
    structures: GameStructure[];
    spreadCenters: Vector3[];
    region: SphereRegion;
    winArea: GameRegion;
    ironPoints: Vector3[];
    ShepherdSpawnpoint: Vector3;
    watingPos: Vector3;
    watingCamera: CameraSetPosOptions;
}

const classicMap: CvSMap = {
    name: "§a小鸡庄园",
    chestPoints: [
        { x: 90, y: -54, z: 109 },
        { x: 91, y: -58, z: 89 },
        { x: 83, y: -59, z: 65 },
        { x: 72, y: -55, z: 73 },
        { x: 117, y: -57, z: 89 },
        { x: 114, y: -58, z: 101 },
        { x: 103, y: -56, z: 107 },
        { x: 76, y: -59, z: 110 },
        { x: 99, y: -55, z: 91 },
    ],
    spreadCenters: [
        { x: 81, y: -59, z: 103 },
        { x: 99, y: -58, z: 116 },
        { x: 112, y: -59, z: 92 },
        { x: 93, y: -59, z: 74 },
        { x: 77, y: -59, z: 80 },
        { x: 80, y: -59, z: 89 },
        { x: 93, y: -59, z: 84 },
        { x: 95, y: -59, z: 97 },
        { x: 107, y: -59, z: 111 },
        { x: 89, y: -59, z: 104 },
        { x: 90, y: -58, z: 114 },
        { x: 88, y: -59, z: 72 },
    ],
    ironPoints: [
        { x: 99, y: -60, z: 105 },
        { x: 80, y: -60, z: 103 },
    ],
    structures: [
        new GameStructure("铁门", { x: 95, y: -58, z: 122 }),
        new GameStructure("麦田", { x: 106, y: -60, z: 78 }),
    ],
    region: new SphereRegion(
        DimensionIds.Overworld,
        { x: 94, y: -59, z: 96 },
        35
    ),
    winArea: new CubeRegion(
        DimensionIds.Overworld,
        { x: 99, y: -59, z: 131 },
        { x: 101, y: -56, z: 134 }
    ),
    ShepherdSpawnpoint: { x: 99.5, y: -58.06, z: 121.5 },
    watingPos: { x: 99.5, y: -57.0, z: 92.5 },
    watingCamera: {
        location: { x: 97.67, y: -29.27, z: 80.43 },
        facingLocation: { x: 97.52, y: -37.12, z: 93.31 },
    },
};

const wasteLand: CvSMap = {
    name: "§v荒?地(作者冰块)",
    chestPoints: [
        { x: 97, y: -54, z: 186 },
        { x: 103, y: -57, z: 181 },
        { x: 94, y: -58, z: 198 },
        { x: 97, y: -58, z: 211 },
        { x: 82, y: -55, z: 202 },
        { x: 62, y: -58, z: 194 },
        { x: 74, y: -53, z: 183 },
        { x: 76, y: -59, z: 216 },
        { x: 119, y: -50, z: 222 },
    ],
    ironPoints: [
        { x: 85, y: -57, z: 190 },
        { x: 109, y: -57, z: 182 },
    ],
    structures: [
        new GameStructure("鸡王争霸_大门", { x: 84, y: -58, z: 175 }),
        new GameStructure("鸡王争霸_前小道", { x: 75, y: -62, z: 177 }),
        new GameStructure("鸡王争霸_后小道", { x: 78, y: -62, z: 176 }),
        new GameStructure("鸡王争霸_2x", { x: 77, y: -59, z: 211 }),
        new GameStructure("鸡王争霸_2x", { x: 65, y: -59, z: 198 }),
        new GameStructure("鸡王争霸_2x", { x: 108, y: -57, z: 190 }),
        new GameStructure("鸡王争霸_2x", { x: 112, y: -57, z: 183 }),
        new GameStructure("鸡王争霸_2x", { x: 87, y: -62, z: 175 }),
        new GameStructure("鸡王争霸_2x", { x: 91, y: -62, z: 175 }),
    ],
    region: new SphereRegion(
        DimensionIds.Overworld,
        { x: 86, y: -59, z: 198 },
        40
    ),
    winArea: new CubeRegion(
        DimensionIds.Overworld,
        { x: 93, y: -56, z: 174 },
        { x: 94, y: -54, z: 173 }
    ),
    spreadCenters: [
        { x: 95, y: -57, z: 184 },
        { x: 102, y: -57, z: 191 },
        { x: 107, y: -58, z: 198 },
        { x: 107, y: -58, z: 207 },
        { x: 111, y: -57, z: 218 },
        { x: 98, y: -58, z: 202 },
        { x: 89, y: -58, z: 207 },
        { x: 84, y: -59, z: 213 },
        { x: 72, y: -59, z: 194 },
        { x: 82, y: -58, z: 187 },
        { x: 86, y: -58, z: 180 },
    ],
    ShepherdSpawnpoint: { x: 87.5, y: -58.0, z: 178.5 },
    watingPos: { x: 89.5, y: -61.0, z: 196.5 },
    watingCamera: {
        location: { x: 91.5, y: -30, z: 198 },
        facingLocation: { x: 91, y: -55, z: 198 },
    },
};

export const CvSMaps = {
    classic: classicMap,
    wasteLand: wasteLand,
};
